﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using HZ.MBSM.DBUtility;
public partial class HomePage_SS : System.Web.UI.Page
{



    string _strtitle, _strselect;
    protected void Page_Load(object sender, EventArgs e)
    {
       

    }
    public string WriteBord()
    {
        _strtitle = SysFun.IsSQL(Request.QueryString["a"].Trim());
        _strtitle = _strtitle.Replace("'", " ");
        int i = 0;
        string _strsql = "";
        _strsql = @"select '政策法规' as tt,title,lawid as id ,adddate,'zcfg' as type from  law  where title like '%" + _strtitle + "%' union select '图片新闻',news_title,news_id,adddate,'tpxw' from  newsPicture where news_title like '%" + _strtitle + "%'  union select '公告通知',title,notid ,adddate,'ggtz' from  Note where title like '%" + _strtitle + "%' union select '操作帮助',title,id,adddate,'czbz' from HelpTable where title like '%" + _strtitle + "%'union    select '采购动态',title,trendid,adddate,'cgdt' from GoodsTrend where title like '%" + _strtitle + "%'  union select '问题反馈',title,id,createdate,'wtfk' from board where title like '%" + _strtitle + "%' ";                                               //要查询的表明

       
        System.Text.StringBuilder sb = new System.Text.StringBuilder();
      
        Db db = new Db();

        System.Data.IDataReader dr = db.DataReader(_strsql);
         sb.Append("<ul>");
        while (dr.Read())
        {
            i++;
            sb.Append("<li>");
            sb.Append("<div style='float:left'><img src='../images/gif-0057.gif' >&nbsp;<a href='ContentShow.aspx?pid=" + MsgBox.JiaMiobj_Encrypt(dr["id"].ToString()) + "&&tid="+dr["type"]+"' target=_blank>【" +  dr["tt"].ToString()+ "】 "+ dr["Title"].ToString() + "</a>");
            if (System.DateTime.Now <= Convert.ToDateTime(dr["AddDate"].ToString()).AddDays(2))
                sb.Append("&nbsp;<img src='../images/new.gif' width='28' height=11></div>");
            else
                sb.Append("</div>");
            sb.Append("<div class=\"TT\">[" + Convert.ToDateTime(dr["AddDate"].ToString()).ToString("yy-MM-dd") + "]</div>");
            sb.Append("</li>");
        }

        sb.Append("</ul>");
        dr.Close();
        dr.Dispose();

        db.Close();

        if (sb.ToString().Equals("<ul></ul>"))
        {
            return "<div style=\"text-align:center; font-size:large; font-weight:bold; color:Blue\">暂无数据</div>";
        }

        return sb.ToString();
    }

}


